﻿CREATE VIEW [dbo].[vwCustomerProjectHours]
AS
SELECT     TOP 100 PERCENT dbo.Customer.CustomerID, dbo.Customer.CustomerName, dbo.EntryLog.EntryDate, dbo.EntryLog.Duration AS EntryDuration, 
                      dbo.EntryLog.Description AS EntryDescription, dbo.EntryLog.UserID, dbo.Users.UserName, dbo.Projects.ProjectID, dbo.Projects.Name AS ProjectName,
                       dbo.Projects.Description AS ProjectDescription
FROM         dbo.Customer INNER JOIN
                      dbo.CustomerProject ON dbo.Customer.CustomerID = dbo.CustomerProject.CustomerID INNER JOIN
                      dbo.EntryLog ON dbo.CustomerProject.ProjectID = dbo.EntryLog.ProjectID INNER JOIN
                      dbo.Users ON dbo.EntryLog.UserID = dbo.Users.UserID INNER JOIN
                      dbo.Projects ON dbo.CustomerProject.ProjectID = dbo.Projects.ProjectID
ORDER BY dbo.EntryLog.EntryDate;

